// part1:C10:ex10.6.cpp
// use fill_n function to set zero of int type sequence.
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char *argv[]) {
  ifstream in(argv[1]);
  if (!in) {
    cout << "failed to open input file!" << endl; 
    exit(1);
  }

  vector<int> v;
  int val;
  while (in >> val) {
    v.push_back(val);
    cout << val << " ";
  }
  cout << endl;

  fill_n(v.begin(), v.size(), 0);
  for (auto iter = v.begin(); iter != v.end(); iter++) {
    cout << *iter << " "; 
  }
  cout << endl;

  return 0;
}
